package com.odm.communitymanage.ui

import android.app.StatusBarManager
import com.odm.communitymanage.R
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import androidx.lifecycle.Observer
import com.blankj.utilcode.util.KeyboardUtils
import com.jeremyliao.liveeventbus.LiveEventBus
import com.leaf.library.StatusBarUtil
import com.odm.communitymanage.base.BaseActivity
import com.odm.communitymanage.core.Constants
import com.odm.communitymanage.util.GlideUtils
import com.wuhenzhizao.titlebar.statusbar.StatusBarUtils
import kotlinx.android.synthetic.main.activity_image_viewer.*


/**
 * @description: 大图详情页面
 * @author: ODM
 * @date: 2020/5/28
 */
class ImageDetailActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        KeyboardUtils.clickBlankArea2HideSoftInput()
        setContentView(R.layout.activity_image_viewer)
        registerLiveEvent()
    }



    /**
     * 收到来自闲置详情页面的加载图片详情的事件
     */
    private fun registerLiveEvent(){
        LiveEventBus.get(Constants.IMAGE_URL , String::class.java)
            .observeSticky(this  , object : Observer<String> {
                override fun onChanged(url: String?) {
                    GlideUtils.getInstance().loadImageUrl(
                        iv_image_detail.context,
                        url,
                        iv_image_detail
                    )
                }
            })
    }


}